package code.main.view.hall
{
	import code.common.assets.AssetsClassName;
	
	import com.bit101.components.ListItem;
	import com.yy.manager.ResourceManager;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.MovieClip;
	
	public class RoomListItem extends ListItem
	{
		private var _view:MovieClip;
		public function RoomListItem(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0, data:Object = null)
		{
			super(parent, xpos, ypos, data);
		}
		
		protected override function addChildren():void {
			this.mouseChildren = false;
			_view = ResourceManager.getMovieClipByName(AssetsClassName.HALL_LIST_ITEM_UI);
			addChild(_view);
		}
		public override function draw() : void
		{
			if(_selected)
			{
				_view.bg.gotoAndStop(3);
			}
			else if(_mouseOver)
			{
				_view.bg.gotoAndStop(2);
			}
			else
			{
				_view.bg.gotoAndStop(1);
			}
			
			if(_data is HallItemVo)
			{
				var vo:HallItemVo = HallItemVo(_data);
				_view.label0.text = vo.tableId;
				_view.label1.text = vo.tableName;
				_view.label2.text = vo.matchNumb;
				_view.label3.text = vo.watchNumb;
				_view.label4.text = vo.minBuyIn;
				_view.label5.text = vo.maxBuyIn;
			}else {
				_view.label0.text = "";
				_view.label1.text = "";
				_view.label2.text = "";
				_view.label3.text = "";
				_view.label4.text = "";
				_view.label5.text = "";
			}
		}
	}
}